package com.gxa.scdx.cloud.user.controller;

import com.gxa.scdx.cloud.user.pojo.Task;
import com.gxa.scdx.cloud.user.service.TaskService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * (Task)表控制层
 *
 * @author 颜可翔
 */
@RestController
@RequestMapping("/task")
public class TaskController {
    /**
     * 服务对象
     */
    @Resource
    private TaskService taskService;

    /**
     * 查询所有数据
     *
     * @return 返回所有数据
     */
    @RequestMapping(value = "/selectAll", method = RequestMethod.GET)
    @ApiOperation(value = "查询所有数据接口", notes = "查询所有数据接口", httpMethod = "GET")
    public Map<String, Object> selectAll() {
        return this.taskService.selectAll();
    }

    /**
     * 通过id查询
     *
     * @return 返回所有数据
     */
    @RequestMapping(value = "/selectById", method = RequestMethod.GET)
    @ApiOperation(value = "查询所有数据接口", notes = "查询所有数据接口", httpMethod = "GET")
    public Map<String, Object> selectById(@RequestParam(name = "id") int id) {
        return this.taskService.selectById(id);
    }

    /**
     * 查询所有数据数量
     *
     * @return 返回所有数据
     */
    @RequestMapping(value = "/count", method = RequestMethod.GET)
    public Map<String, Object> count( ) {
        return this.taskService.count();
    }


}